public class Lesson05运算符 {
    public static void main(String[] args) {
        //二元运算符
        //command+D:复制当前行到下一行
        int a = 10;
        int b = 20;
        System.out.println(a+b);
        System.out.println(a-b);
        System.out.println(a*b);
        System.out.println(a/(double)b);
        long c = 123123123123123L;
        int d = 123;
        short e = 10;
        byte f = 8;
        System.out.println(c+d+e+f);//long
        System.out.println(d+e+f);//int
        System.out.println((double)e+f);//int
        int g = 10;
        int h = 20;
        int i = 21;
        System.out.println(g>h);
        System.out.println(g<h);
        System.out.println(g == h);
        System.out.println(g != h);
        System.out.println(i%g);
        //一元运算符++ -- 自增 自减
        int j = 3;

        int k = j++;//执行完这行代码后，先给b赋值，再自增
        //j = j + 1
        System.out.println(k);
        System.out.println(j);
        //j++   j = j + 1
        int l = ++j;//执行完这行代码前，先自增，再给b赋值
        System.out.println(l);

        //幂运算
        double pow = Math.pow(2,3);
        System.out.println(pow);

        //逻辑运算符：与 或 非
        boolean m = true;
        boolean n = false;
        System.out.println("m&&n:"+(m&&n));//两个都为真才是真，若前面为错的，则直接短路，不执行后面的
        System.out.println("m||n:"+(m||n));//两个中有一个为真就是真
        System.out.println("!(m&&n):"+(!(m&&n)));//如果是真则为假，如果是假则为真

        //三元运算符


    }

}
